﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using DotNetChatServer.Contract;
using Contract.Data;
using DotNetChatServer.Interfaces;

namespace DotNetChatServer {
	



	// NOTE: If you change the class name "ChatServer" here, you must also update the reference to "ChatServer" in Web.config.
	public class ChatServer : IChatServer {

		#region IChatServer Members

		public ChatMember Login(string userName, int avatar) {
			return ChatServerSingleton.Instance.Members.CreateLogin(userName, avatar);
		}


		public void Logout(ChatMember member) {
			 ChatServerSingleton.Instance.Members.DeleteLogin(member);
		}

		public void AddMessage(ChatMessage msg) {
			ChatServerSingleton.Instance.Messages.AddMessage(msg);
		}

		public List<ChatMessage> GetMessages() {
			return ChatServerSingleton.Instance.Messages.GetMessages();
		}

		#endregion
	}
}
